home *** CD-ROM | disk | FTP | other *** search
/ Halting the Hacker - A P…uide to Computer Security / Halting the Hacker - A Practical Guide to Computer Security.iso / rfc / rfc1910.txt < prev    next >
Text File  |  1997-04-01  |  98KB  |  2,468 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7. Network Working Group                                  G. Waters, Editor
  8. Request for Comments: 1910                   Bell-Northern Research Ltd.
  9. Category: Experimental                                     February 1996
  10.  
  11.  
  12.                   User-based Security Model for SNMPv2
  13.  
  14. Status of this Memo
  15.  
  16.    This memo defines an Experimental Protocol for the Internet
  17.    community.  This memo does not specify an Internet standard of any
  18.    kind.  Discussion and suggestions for improvement are requested.
  19.    Distribution of this memo is unlimited.
  20.  
  21. Table of Contents
  22.  
  23.    1. Introduction ................................................    2
  24.    1.1 Threats ....................................................    3
  25.    1.2 Goals and Constraints ......................................    4
  26.    1.3 Security Services ..........................................    5
  27.    1.4 Mechanisms .................................................    5
  28.    1.4.1 Digest Authentication Protocol ...........................    7
  29.    1.4.2 Symmetric Encryption Protocol ............................    8
  30.    2. Elements of the Model .......................................   10
  31.    2.1 SNMPv2 Users ...............................................   10
  32.    2.2 Contexts and Context Selectors .............................   11
  33.    2.3 Quality of Service (qoS) ...................................   13
  34.    2.4 Access Policy ..............................................   13
  35.    2.5 Replay Protection ..........................................   13
  36.    2.5.1 agentID ..................................................   14
  37.    2.5.2 agentBoots and agentTime .................................   14
  38.    2.5.3 Time Window ..............................................   15
  39.    2.6 Error Reporting ............................................   15
  40.    2.7 Time Synchronization .......................................   16
  41.    2.8 Proxy Error Propagation ....................................   16
  42.    2.9 SNMPv2 Messages Using this Model ...........................   16
  43.    2.10 Local Configuration Datastore (LCD) .......................   18
  44.    3. Elements of Procedure .......................................   19
  45.    3.1 Generating a Request or Notification .......................   19
  46.    3.2 Processing a Received Communication ........................   20
  47.    3.2.1 Additional Details .......................................   28
  48.    3.2.1.1 ASN.1 Parsing Errors ...................................   28
  49.    3.2.1.2 Incorrectly Encoded Parameters .........................   29
  50.    3.2.1.3 Generation of a Report PDU .............................   29
  51.    3.2.1.4 Cache Timeout ..........................................   29
  52.    3.3 Generating a Response ......................................   30
  53.    4. Discovery ...................................................   30
  54.    5. Definitions .................................................   31
  55.  
  56.  
  57.  
  58. Waters                        Experimental                      [Page 1]
  59.  
  60. RFC 1910          User-based Security Model for SNMPv2     February 1996
  61.  
  62.  
  63.    4.1 The USEC Basic Group .......................................   32
  64.    4.2 Conformance Information ....................................   35
  65.    4.2.1 Compliance Statements ....................................   35
  66.    4.2.2 Units of Conformance .....................................   35
  67.    6. Security Considerations .....................................   36
  68.    6.1 Recommended Practices ......................................   36
  69.    6.2 Defining Users .............................................   37
  70.    6.3 Conformance ................................................   38
  71.    7. Editor's Address ............................................   38
  72.    8. Acknowledgements ............................................   39
  73.    9. References ..................................................   39
  74.    Appendix A Installation ........................................   41
  75.    Appendix A.1 Agent Installation Parameters .....................   41
  76.    Appendix A.2 Password to Key Algorithm .........................   43
  77.    Appendix A.3 Password to Key Sample ............................   44
  78.  
  79. 1.  Introduction
  80.  
  81.    A management system contains:  several (potentially many) nodes, each
  82.    with a processing entity, termed an agent, which has access to
  83.    management instrumentation; at least one management station; and, a
  84.    management protocol, used to convey management information between
  85.    the agents and management stations.  Operations of the protocol are
  86.    carried out under an administrative framework which defines
  87.    authentication, authorization, access control, and privacy policies.
  88.  
  89.    Management stations execute management applications which monitor and
  90.    control managed elements.  Managed elements are devices such as
  91.    hosts, routers, terminal servers, etc., which are monitored and
  92.    controlled via access to their management information.
  93.  
  94.    The Administrative Infrastructure for SNMPv2 document [1] defines an
  95.    administrative framework which realizes effective management in a
  96.    variety of configurations and environments.
  97.  
  98.    In this administrative framework, a security model defines the
  99.    mechanisms used to achieve an administratively-defined level of
  100.    security for protocol interactions.  Although many such security
  101.    models might be defined, it is the purpose of this document, User-
  102.    based Security Model for SNMPv2, to define the first, and, as of this
  103.    writing, only, security model for this administrative framework.
  104.  
  105.    This administrative framework includes the provision of an access
  106.    control model.  The enforcement of access rights requires the means
  107.    to identify the entity on whose behalf a request is generated.  This
  108.    SNMPv2 security model identifies an entity on whose behalf an SNMPv2
  109.    message is generated as a "user".
  110.  
  111.  
  112.  
  113.  
  114. Waters                        Experimental                      [Page 2]
  115.  
  116. RFC 1910          User-based Security Model for SNMPv2     February 1996
  117.  
  118.  
  119. 1.1.  Threats
  120.  
  121.    Several of the classical threats to network protocols are applicable
  122.    to the network management problem and therefore would be applicable
  123.    to any SNMPv2 security model.  Other threats are not applicable to
  124.    the network management problem.  This section discusses principal
  125.    threats, secondary threats, and threats which are of lesser
  126.    importance.
  127.  
  128.    The principal threats against which this SNMPv2 security model should
  129.    provide protection are:
  130.  
  131. Modification of Information
  132.      The modification threat is the danger that some unauthorized entity
  133.      may alter in-transit SNMPv2 messages generated on behalf of an
  134.      authorized user in such a way as to effect unauthorized management
  135.      operations, including falsifying the value of an object.
  136.  
  137. Masquerade
  138.      The masquerade threat is the danger that management operations not
  139.      authorized for some user may be attempted by assuming the identity
  140.      of another user that has the appropriate authorizations.
  141.  
  142.    Two secondary threats are also identified.  The security protocols
  143.    defined in this memo do provide protection against:
  144.  
  145. Message Stream Modification
  146.      The SNMPv2 protocol is typically based upon a connectionless
  147.      transport service which may operate over any subnetwork service.
  148.      The re-ordering, delay or replay of messages can and does occur
  149.      through the natural operation of many such subnetwork services.
  150.      The message stream modification threat is the danger that messages
  151.      may be maliciously re-ordered, delayed or replayed to an extent
  152.      which is greater than can occur through the natural operation of a
  153.      subnetwork service, in order to effect unauthorized management
  154.      operations.
  155.  
  156. Disclosure
  157.      The disclosure threat is the danger of eavesdropping on the
  158.      exchanges between managed agents and a management station.
  159.      Protecting against this threat may be required as a matter of local
  160.      policy.
  161.  
  162.    There are at least two threats that an SNMPv2 security protocol need
  163.    not protect against.  The security protocols defined in this memo do
  164.    not provide protection against:
  165.  
  166.  
  167.  
  168.  
  169.  
  170. Waters                        Experimental                      [Page 3]
  171.  
  172. RFC 1910          User-based Security Model for SNMPv2     February 1996
  173.  
  174.  
  175. Denial of Service
  176.      An SNMPv2 security protocol need not attempt to address the broad
  177.      range of attacks by which service on behalf of authorized users is
  178.      denied.  Indeed, such denial-of-service attacks are in many cases
  179.      indistinguishable from the type of network failures with which any
  180.      viable network management protocol must cope as a matter of course.
  181.  
  182. Traffic Analysis
  183.      In addition, an SNMPv2 security protocol need not attempt to
  184.      address traffic analysis attacks.  Indeed, many traffic patterns
  185.      are predictable - agents may be managed on a regular basis by a
  186.      relatively small number of management stations - and therefore
  187.      there is no significant advantage afforded by protecting against
  188.      traffic analysis.
  189.  
  190. 1.2.  Goals and Constraints
  191.  
  192.    Based on the foregoing account of threats in the SNMP network
  193.    management environment, the goals of this SNMPv2 security model are
  194.    as follows.
  195.  
  196. (1)  The protocol should provide for verification that each received
  197.      SNMPv2 message has not been modified during its transmission
  198.      through the network in such a way that an unauthorized management
  199.      operation might result.
  200.  
  201. (2)  The protocol should provide for verification of the identity of the
  202.      user on whose behalf a received SNMPv2 message claims to have been
  203.      generated.
  204.  
  205. (3)  The protocol should provide for detection of received SNMPv2
  206.      messages, which request or contain management information, whose
  207.      time of generation was not recent.
  208.  
  209. (4)  The protocol should provide, when necessary, that the contents of
  210.      each received SNMPv2 message are protected from disclosure.
  211.  
  212.    In addition to the principal goal of supporting secure network
  213.    management, the design of this SNMPv2 security model is also
  214.    influenced by the following constraints:
  215.  
  216. (1)  When the requirements of effective management in times of network
  217.      stress are inconsistent with those of security, the design should
  218.      prefer the former.
  219.  
  220. (2)  Neither the security protocol nor its underlying security
  221.      mechanisms should depend upon the ready availability of other
  222.      network services (e.g., Network Time Protocol (NTP) or key
  223.  
  224.  
  225.  
  226. Waters                        Experimental                      [Page 4]
  227.  
  228. RFC 1910          User-based Security Model for SNMPv2     February 1996
  229.  
  230.  
  231.      management protocols).
  232.  
  233. (3)  A security mechanism should entail no changes to the basic SNMP
  234.      network management philosophy.
  235.  
  236. 1.3.  Security Services
  237.  
  238.    The security services necessary to support the goals of an SNMPv2
  239.    security model are as follows.
  240.  
  241. Data Integrity
  242.      is the provision of the property that data has not been altered or
  243.      destroyed in an unauthorized manner, nor have data sequences been
  244.      altered to an extent greater than can occur non-maliciously.
  245.  
  246. Data Origin Authentication
  247.      is the provision of the property that the claimed identity of the
  248.      user on whose behalf received data was originated is corroborated.
  249.  
  250. Data Confidentiality
  251.      is the provision of the property that information is not made
  252.      available or disclosed to unauthorized individuals, entities, or
  253.      processes.
  254.  
  255.    For the protocols specified in this memo, it is not possible to
  256.    assure the specific originator of a received SNMPv2 message; rather,
  257.    it is the user on whose behalf the message was originated that is
  258.    authenticated.
  259.  
  260.    For these protocols, it not possible to obtain data integrity without
  261.    data origin authentication, nor is it possible to obtain data origin
  262.    authentication without data integrity.  Further, there is no
  263.    provision for data confidentiality without both data integrity and
  264.    data origin authentication.
  265.  
  266.    The security protocols used in this memo are considered acceptably
  267.    secure at the time of writing.  However, the procedures allow for new
  268.    authentication and privacy methods to be specified at a future time
  269.    if the need arises.
  270.  
  271. 1.4.  Mechanisms
  272.  
  273.    The security protocols defined in this memo employ several types of
  274.    mechanisms in order to realize the goals and security services
  275.    described above:
  276.  
  277.  
  278.  
  279.  
  280.  
  281.  
  282. Waters                        Experimental                      [Page 5]
  283.  
  284. RFC 1910          User-based Security Model for SNMPv2     February 1996
  285.  
  286.  
  287.   -  In support of data integrity, a message digest algorithm is
  288.      required.  A digest is calculated over an appropriate portion of an
  289.      SNMPv2 message and included as part of the message sent to the
  290.      recipient.
  291.  
  292.   -  In support of data origin authentication and data integrity, a
  293.      secret value is both inserted into, and appended to, the SNMPv2
  294.      message prior to computing the digest; the inserted value
  295.      overwritten prior to transmission, and the appended value is not
  296.      transmitted.  The secret value is shared by all SNMPv2 entities
  297.      authorized to originate messages on behalf of the appropriate user.
  298.  
  299.   -  To protect against the threat of message delay or replay (to an
  300.      extent greater than can occur through normal operation), a set of
  301.      time (at the agent) indicators and a request-id are included in
  302.      each message generated.  An SNMPv2 agent evaluates the time
  303.      indicators to determine if a received message is recent.  An SNMPv2
  304.      manager evaluates the time indicators to ensure that a received
  305.      message is at least as recent as the last message it received from
  306.      the same source.  An SNMPv2 manager uses received authentic
  307.      messages to advance its notion of time (at the agent).  An  SNMPv2
  308.      manager also evaluates the request-id in received Response messages
  309.      and discards messages which do not correspond to outstanding
  310.      requests.
  311.  
  312.      These mechanisms provide for the detection of messages whose time
  313.      of generation was not recent in all but one circumstance; this
  314.      circumstance is the delay or replay of a Report  message (sent to a
  315.      manager) when the manager has has not recently communicated with
  316.      the source of the Report message.  In this circumstance, the
  317.      detection guarantees only that the Report message is more recent
  318.      than the last communication between source and destination of the
  319.      Report message.  However, Report messages do not request or contain
  320.      management information, and thus, goal #3 in Section 1.2 above is
  321.      met; further, Report messages can at most cause the manager to
  322.      advance its notion of time (at the agent) by less than the proper
  323.      amount.
  324.  
  325.      This protection against the threat of message delay or replay does
  326.      not imply nor provide any protection against unauthorized deletion
  327.      or suppression of messages.  Other mechanisms defined independently
  328.      of the security protocol can also be used to detect the re-
  329.      ordering, replay, deletion, or suppression of messages containing
  330.      set operations (e.g., the MIB variable snmpSetSerialNo [15]).
  331.  
  332.   -  In support of data confidentiality, an encryption algorithm is
  333.      required.  An appropriate portion of the message is encrypted prior
  334.      to being transmitted.
  335.  
  336.  
  337.  
  338. Waters                        Experimental                      [Page 6]
  339.  
  340. RFC 1910          User-based Security Model for SNMPv2     February 1996
  341.  
  342.  
  343. 1.4.1.  Digest Authentication Protocol
  344.  
  345.    The Digest Authentication Protocol defined in this memo provides for:
  346.  
  347.   -  verifying the integrity of a received message (i.e., the message
  348.      received is the message sent).
  349.  
  350.      The integrity of the message is protected by computing a digest
  351.      over an appropriate portion of a message.  The digest is computed
  352.      by the originator of the message, transmitted with the message, and
  353.      verified by the recipient of the message.
  354.  
  355.   -  verifying the user on whose behalf the message was generated.
  356.  
  357.      A secret value known only to SNMPv2 entities authorized to generate
  358.      messages on behalf of this user is both inserted into, and appended
  359.      to, the message prior to the digest computation.  Thus, the
  360.      verification of the user is implicit with the verification of the
  361.      digest.  (Note that the use of two copies of the secret, one near
  362.      the start and one at the end, is recommended by [14].)
  363.  
  364.   -  verifying that a message sent to/from one SNMPv2 entity cannot be
  365.      replayed to/as-if-from another SNMPv2 entity.
  366.  
  367.      Included in each message is an identifier unique to the SNMPv2
  368.      agent associated with the sender or intended recipient of the
  369.      message.  Also, each message containing a Response PDU contains a
  370.      request-id which associates the message to a recently generated
  371.      request.
  372.  
  373.      A Report message sent by one SNMPv2 agent to one SNMPv2 manager can
  374.      potentially be replayed to another SNMPv2 manager.  However, Report
  375.      messages do not request or contain management information, and
  376.      thus, goal #3 in Section 1.2 above is met; further, Report messages
  377.      can at most cause the manager to advance its notion of time (at the
  378.      agent) by less than the correct amount.
  379.  
  380.   -  detecting messages which were not recently generated.
  381.  
  382.      A set of time indicators are included in the message, indicating
  383.      the time of generation.  Messages (other than those containing
  384.      Report PDUs) without recent time indicators are not considered
  385.      authentic.  In addition, messages containing Response PDUs have a
  386.      request-id; if the request-id does not match that of a recently
  387.      generated request, then the message is not considered to be
  388.      authentic.
  389.  
  390.  
  391.  
  392.  
  393.  
  394. Waters                        Experimental                      [Page 7]
  395.  
  396. RFC 1910          User-based Security Model for SNMPv2     February 1996
  397.  
  398.  
  399.      A Report message sent by an SNMPv2 agent can potentially be
  400.      replayed at a later time to an SNMPv2 manager which has not
  401.      recently communicated with that agent.  However, Report messages do
  402.      not request or contain management information, and thus, goal #3 in
  403.      Section 1.2 above is met; further, Report messages can at most
  404.      cause the manager to advance its notion of time (at the agent) by
  405.      less than the correct amount.
  406.  
  407.    This protocol uses the MD5 [3] message digest algorithm.  A 128-bit
  408.    digest is calculated over the designated portion of an SNMPv2 message
  409.    and included as part of the message sent to the recipient.  The size
  410.    of both the digest carried in a message and the private
  411.    authentication key is 16 octets.
  412.  
  413.    This memo allows the same user to be defined on multiple SNMPv2
  414.    agents and managers.  Each SNMPv2 agent maintains a value, agentID,
  415.    which uniquely identifies the agent. This value is included in each
  416.    message sent to/from that agent.  Messages sent from a SNMPv2 dual-
  417.    role entity [1] to a SNMPv2 manager include the agentID value
  418.    maintained by the dual-role entity's agent.  On receipt of a message,
  419.    an agent checks the value to ensure it is the intended recipient, and
  420.    a manager uses the value to ensure that the message is processed
  421.    using the correct state information.
  422.  
  423.    Each SNMPv2 agent maintains two values, agentBoots and agentTime,
  424.    which taken together provide an indication of time at that agent.
  425.    Both of these values are included in an authenticated message sent
  426.    to/received from that agent.  Authenticated messages sent from a
  427.    SNMPv2 dual-role entity to a SNMPv2 manager include the agentBoots
  428.    and agentTime values maintained by the dual-role entity's agent.  On
  429.    receipt, the values are checked to ensure that the indicated time is
  430.    within a time window of the current time.  The time window represents
  431.    an administrative upper bound on acceptable delivery delay for
  432.    protocol messages.
  433.  
  434.    For an SNMPv2 manager to generate a message which an agent will
  435.    accept as authentic, and to verify that a message received from that
  436.    agent is authentic, that manager must first achieve time
  437.    synchronization with that agent.  Similarly, for a manger to verify
  438.    that a message received from an SNMPv2 dual-role entity is authentic,
  439.    that manager must first achieve time synchronization with the dual-
  440.    role entity's agent.
  441.  
  442. 1.4.2.  Symmetric Encryption Protocol
  443.  
  444.    The Symmetric Encryption Protocol defined in this memo provides
  445.    support for data confidentiality through the use of the Data
  446.    Encryption Standard (DES) in the Cipher Block Chaining mode of
  447.  
  448.  
  449.  
  450. Waters                        Experimental                      [Page 8]
  451.  
  452. RFC 1910          User-based Security Model for SNMPv2     February 1996
  453.  
  454.  
  455.    operation.  The designated portion of an SNMPv2 message is encrypted
  456.    and included as part of the message sent to the recipient.
  457.  
  458.    Two organizations have published specifications defining the DES: the
  459.    National Institute of Standards and Technology (NIST) [5] and the
  460.    American National Standards Institute [6].  There is a companion
  461.    Modes of Operation specification for each definition (see [7] and
  462.    [8], respectively).
  463.  
  464.    The NIST has published three additional documents that implementors
  465.    may find useful.
  466.  
  467.   -  There is a document with guidelines for implementing and using the
  468.      DES, including functional specifications for the DES and its modes
  469.      of operation [9].
  470.  
  471.   -  There is a specification of a validation test suite for the DES
  472.      [10].  The suite is designed to test all aspects of the DES and is
  473.      useful for pinpointing specific problems.
  474.  
  475.   -  There is a specification of a maintenance test for the DES [11].
  476.      The test utilizes a minimal amount of data and processing to test
  477.      all components of the DES.  It provides a simple yes-or-no
  478.      indication of correct operation and is useful to run as part of an
  479.      initialization step, e.g., when a computer reboots.
  480.  
  481.    This Symmetric Encryption Protocol specifies that the size of the
  482.    privacy key is 16 octets, of which the first 8 octets are a DES key
  483.    and the second 8 octets are a DES Initialization Vector.  The 64-bit
  484.    DES key in the first 8 octets of the private key is a 56 bit quantity
  485.    used directly by the algorithm plus 8 parity bits - arranged so that
  486.    one parity bit is the least significant bit of each octet.  The
  487.    setting of the parity bits is ignored by this protocol.
  488.  
  489.    The length of an octet sequence to be encrypted by the DES must be an
  490.    integral multiple of 8.  When encrypting, the data is padded at the
  491.    end as necessary; the actual pad value is irrelevant.
  492.  
  493.    If the length of the octet sequence to be decrypted is not an
  494.    integral multiple of 8 octets, the processing of the octet sequence
  495.    is halted and an appropriate exception noted.  When decrypting, the
  496.    padding is ignored.
  497.  
  498.  
  499.  
  500.  
  501.  
  502.  
  503.  
  504.  
  505.  
  506. Waters                        Experimental                      [Page 9]
  507.  
  508. RFC 1910          User-based Security Model for SNMPv2     February 1996
  509.  
  510.  
  511. 2.  Elements of the Model
  512.  
  513.    This section contains definitions required to realize the security
  514.    model defined by this memo.
  515.  
  516. 2.1.  SNMPv2 Users
  517.  
  518.    Management operations using this security model make use of a defined
  519.    set of user identities.  For any SNMPv2 user on whose behalf
  520.    management operations are authorized at a particular SNMPv2 agent,
  521.    that agent must have knowledge of that user.  A SNMPv2 manager that
  522.    wishes to communicate with a particular agent must also have
  523.    knowledge of a user known to that agent, including knowledge of the
  524.    applicable attributes of that user.  Similarly, a SNMPv2 manager that
  525.    wishes to receive messages from a SNMPv2 dual-role entity must have
  526.    knowledge of the user on whose behalf the dual-role entity sends the
  527.    message.
  528.  
  529.    A user and its attributes are defined as follows:
  530.  
  531. <userName>
  532.      An octet string representing the name of the user.
  533.  
  534. <authProtocol>
  535.      An indication of whether messages sent on behalf of this user can
  536.      be authenticated, and if so, the type of authentication protocol
  537.      which is used.  One such protocol is defined in this memo: the
  538.      Digest Authentication Protocol.
  539.  
  540. <authPrivateKey>
  541.      If messages sent on behalf of this user can be authenticated, the
  542.      (private) authentication key for use with the authentication
  543.      protocol.  Note that a user's authentication key will normally be
  544.      different at different agents.
  545.  
  546. <privProtocol>
  547.      An indication of whether messages sent on behalf of this user can
  548.      be protected from disclosure, and if so, the type of privacy
  549.      protocol which is used.  One such protocol is defined in this memo:
  550.      the Symmetric Encryption Protocol.
  551.  
  552. <privPrivateKey>
  553.      If messages sent on behalf of this user can be protected from
  554.      disclosure, the (private) privacy key for use with the privacy
  555.      protocol.  Note that a user's privacy key will normally be
  556.      different at different agents.
  557.  
  558.  
  559.  
  560.  
  561.  
  562. Waters                        Experimental                     [Page 10]
  563.  
  564. RFC 1910          User-based Security Model for SNMPv2     February 1996
  565.  
  566.  
  567. 2.2.  Contexts and Context Selectors
  568.  
  569.    An SNMPv2 context is a collection of management information
  570.    accessible (locally or via proxy) by an SNMPv2 agent.  An item of
  571.    management information may exist in more than one context.  An SNMPv2
  572.    agent potentially has access to many contexts.  Each SNMPv2 message
  573.    contains a context selector which unambiguously identifies an SNMPv2
  574.    context accessible by the SNMPv2 agent to which the message is
  575.    directed or by the SNMPv2 agent associated with the sender of the
  576.    message.
  577.  
  578.    For a local SNMPv2 context which is realized by an SNMPv2 entity,
  579.    that SNMPv2 entity uses locally-defined mechanisms to access the
  580.    management information identified by the SNMPv2 context.
  581.  
  582.    For a proxy SNMPv2 context, the SNMPv2 entity acts as a proxy SNMPv2
  583.    agent to access the management information identified by the SNMPv2
  584.    context.
  585.  
  586.    The term remote SNMPv2 context is used at an SNMPv2 manager to
  587.    indicate a SNMPv2 context (either local or proxy) which is not
  588.    realized by the local SNMPv2 entity (i.e., the local SNMPv2 entity
  589.    uses neither locally-defined mechanisms, nor acts as a proxy SNMPv2
  590.    agent to access the management information identified by the SNMPv2
  591.    context).
  592.  
  593.    Proxy SNMPv2 contexts are further categorized as either local-proxy
  594.    contexts or remote-proxy contexts.  A proxy SNMPv2 agent receives
  595.    Get/GetNext/GetBulk/Set operations for a local-proxy context, and
  596.    forwards them with a remote-proxy context; it receives SNMPv2-Trap
  597.    and Inform operations for a remote-proxy context, and forwards them
  598.    with a local-proxy context; for Response operations, a proxy SNMPv2
  599.    agent receives them with either a local-proxy or remote-proxy
  600.    context, and forwards them with a remote-proxy or local-proxy
  601.    context, respectively.
  602.  
  603.  
  604.  
  605.  
  606.  
  607.  
  608.  
  609.  
  610.  
  611.  
  612.  
  613.  
  614.  
  615.  
  616.  
  617.  
  618. Waters                        Experimental                     [Page 11]
  619.  
  620. RFC 1910          User-based Security Model for SNMPv2     February 1996
  621.  
  622.  
  623.      For the non-proxy situation:
  624.  
  625.                       context-A
  626.          Manager <----------------> Agent
  627.  
  628.      the type of context is:
  629.  
  630.                            +-----------------+
  631.                            |   context-A     |
  632.          +-----------------+-----------------+
  633.          | Manager         |    remote       |
  634.          +-----------------+-----------------+
  635.          | Agent           |    local        |
  636.          +-----------------+-----------------+
  637.          | agentID         |   of Agent      |
  638.          +-----------------+-----------------+
  639.          | contextSelector | locally unique  |
  640.          +-----------------+-----------------+
  641.  
  642.      For proxy:
  643.  
  644.                       context-B               context-C
  645.          Manager <----------------> Proxy <----------------> Agent
  646.                                     Agent
  647.  
  648.      the type and identity of the contexts are:
  649.  
  650.                            +-----------------+-----------------+
  651.                            |   context-B     |    context-C    |
  652.          +-----------------+-----------------+-----------------+
  653.          | Manager         |    remote       |       --        |
  654.          +-----------------+-----------------+-----------------+
  655.          | Proxy-Agent     |  local-proxy    |   remote-proxy  |
  656.          +-----------------+-----------------+-----------------+
  657.          | Agent           |      --         |      local      |
  658.          +-----------------+-----------------+-----------------+
  659.          | agentID         | of Proxy agent  |     of Agent    |
  660.          +-----------------+-----------------+-----------------+
  661.          | contextSelector | locally unique  |  locally unique |
  662.          +-----------------+-----------------+-----------------+
  663.  
  664.    The combination of an agentID value and a context selector provides a
  665.    globally-unique identification of a context.  When a context is
  666.    accessible by multiple agents (e.g., including by proxy SNMPv2
  667.    agents), it has multiple such globally-unique identifications, one
  668.    associated with each agent which can access it. In the example above,
  669.    "context-B" and "context-C" are different names for the same context.
  670.  
  671.  
  672.  
  673.  
  674. Waters                        Experimental                     [Page 12]
  675.  
  676. RFC 1910          User-based Security Model for SNMPv2     February 1996
  677.  
  678.  
  679. 2.3.  Quality of Service (qoS)
  680.  
  681.    Messages are generated with a particular Quality of Service (qoS),
  682.    either:
  683.  
  684.   -  without authentication and privacy,
  685.  
  686.   -  with authentication but not privacy,
  687.  
  688.   -  with authentication and privacy.
  689.  
  690.    All users are capable of having messages without authentication and
  691.    privacy generated on their behalf.  Users having an authentication
  692.    protocol and an authentication key can have messages with
  693.    authentication but not privacy generated on their behalf. Users
  694.    having an authentication protocol, an authentication key, a privacy
  695.    protocol and a privacy key can have messages with authentication and
  696.    privacy generated on their behalf.
  697.  
  698.    In addition to its indications of authentication and privacy, the qoS
  699.    may also indicate that the message contains an operation that may
  700.    result in a report PDU being generated (see Section 2.6 below).
  701.  
  702. 2.4.  Access Policy
  703.  
  704.    An administration's access policy determines the access rights of
  705.    users.  For a particular SNMPv2 context to which a user has access
  706.    using a particular qoS, that user's access rights are given by a list
  707.    of authorized operations, and for a local context, a read-view and a
  708.    write-view.  The read-view is the set of object instances authorized
  709.    for the user when reading objects.  Reading objects occurs when
  710.    processing a retrieval (get, get-next, get-bulk) operation and when
  711.    sending a notification.  The write-view is the set of object
  712.    instances authorized for the user when writing objects.  Writing
  713.    objects occurs when processing a set operation.  A user's access
  714.    rights may be different at different agents.
  715.  
  716. 2.5.  Replay Protection
  717.  
  718.    Each SNMPv2 agent (or dual-role entity) maintains three objects:
  719.  
  720.   -  agentID, which is an identifier unique among all agents in (at
  721.      least) an administrative domain;
  722.  
  723.   -  agentBoots, which is a count of the number of times the agent has
  724.      rebooted/re-initialized since agentID was last configured; and,
  725.  
  726.  
  727.  
  728.  
  729.  
  730. Waters                        Experimental                     [Page 13]
  731.  
  732. RFC 1910          User-based Security Model for SNMPv2     February 1996
  733.  
  734.  
  735.   -  agentTime, which is the number of seconds since agentBoots was last
  736.      incremented.
  737.  
  738.    An SNMPv2 agent is always authoritative with respect to these
  739.    variables.  It is the responsibility of an SNMPv2 manager to
  740.    synchronize with the agent, as appropriate.  In the case of an SNMPv2
  741.    dual-role entity sending an Inform-Request, it is that entity acting
  742.    in an agent role which is authoritative with respect to these
  743.    variables for the Inform-Request.
  744.  
  745.    An agent is required to maintain the values of agentID and agentBoots
  746.    in non-volatile storage.
  747.  
  748. 2.5.1.  agentID
  749.  
  750.    The agentID value contained in an authenticated message is used to
  751.    defeat attacks in which messages from a manager are replayed to a
  752.    different agent and/or messages from one agent (or dual-role entity)
  753.    are replayed as if from a different agent (or dual-role entity).
  754.  
  755.    When an agent (or dual-role entity) is first installed, it sets its
  756.    local value of agentID according to a enterprise-specific algorithm
  757.    (see the definition of agentID in Section 4.1).
  758.  
  759. 2.5.2.  agentBoots and agentTime
  760.  
  761.    The agentBoots and agentTime values contained in an authenticated
  762.    message are used to defeat attacks in which messages are replayed
  763.    when they are no longer valid.  Through use of agentBoots and
  764.    agentTime, there is no requirement for an SNMPv2 agent to have a
  765.    non-volatile clock which ticks (i.e., increases with the passage of
  766.    time) even when the agent is powered off.  Rather, each time an
  767.    SNMPv2 agent reboots, it retrieves, increments, and then stores
  768.    agentBoots in non-volatile storage, and resets agentTime to zero.
  769.  
  770.    When an agent (or dual-role entity) is first installed, it sets its
  771.    local values of agentBoots and agentTime to zero.  If agentTime ever
  772.    reaches its maximum value (2147483647), then agentBoots is
  773.    incremented as if the agent has rebooted and agentTime is reset to
  774.    zero and starts incrementing again.
  775.  
  776.    Each time an agent (or dual-role entity) reboots, any SNMPv2 managers
  777.    holding that agent's values of agentBoots and agentTime need to re-
  778.    synchronize prior to sending correctly authenticated messages to that
  779.    agent (see Section 2.7 for re-synchronization procedures).  Note,
  780.    however, that the procedures do provide for a notification to be
  781.    accepted as authentic by a manager, when sent by an agent which has
  782.    rebooted since the manager last re-synchronized.
  783.  
  784.  
  785.  
  786. Waters                        Experimental                     [Page 14]
  787.  
  788. RFC 1910          User-based Security Model for SNMPv2     February 1996
  789.  
  790.  
  791.    If an agent (or dual-role entity) is ever unable to determine its
  792.    latest agentBoots value, then it must set its agentBoots value to
  793.    0xffffffff.
  794.  
  795.    Whenever the local value of agentBoots has the value 0xffffffff, it
  796.    latches at that value and an authenticated message always causes an
  797.    usecStatsNotInWindows authentication failure.
  798.  
  799.    In order to reset an agent whose agentBoots value has reached the
  800.    value 0xffffffff, manual intervention is required.  The agent must be
  801.    physically visited and re-configured, either with a new agentID
  802.    value, or with new secret values for the authentication and privacy
  803.    keys of all users known to that agent.
  804.  
  805. 2.5.3.  Time Window
  806.  
  807.    The Time Window is a value that specifies the window of time in which
  808.    a message generated on behalf of any user is valid.  This memo
  809.    specifies that the same value of the Time Window, 150 seconds, is
  810.    used for all users.
  811.  
  812. 2.6.  Error Reporting
  813.  
  814.    While processing a received communication, an SNMPv2 entity may
  815.    determine that the message is unacceptable (see Section 3.2).  In
  816.    this case, the appropriate counter from the snmpGroup [15] or
  817.    usecStatsGroup object groups is incremented and the received message
  818.    is discarded without further processing.
  819.  
  820.    If an SNMPv2 entity acting in the agent role makes such a
  821.    determination and the qoS indicates that a report may be generated,
  822.    then after incrementing the appropriate counter, it is required to
  823.    generate a message containing a report PDU, with the same user and
  824.    context as the received message, and to send it to the transport
  825.    address which originated the received message.  For all report PDUs,
  826.    except those generated due to incrementing the usecStatsNotInWindows
  827.    counter, the report PDU is unauthenticated.  For those generated due
  828.    to incrementing usecStatsNotInWindows, the report PDU is
  829.    authenticated only if the received message was authenticated.
  830.  
  831.    The report flag in the qoS may only be set if the message contains a
  832.    Get, GetNext, GetBulk, Set operation.  The report flag should never
  833.    be set for a message that contains a Response, Inform, SNMPv2-Trap or
  834.    Report operation.  Furthermore, a report PDU is never sent by an
  835.    SNMPv2 entity acting in a manager role.
  836.  
  837.  
  838.  
  839.  
  840.  
  841.  
  842. Waters                        Experimental                     [Page 15]
  843.  
  844. RFC 1910          User-based Security Model for SNMPv2     February 1996
  845.  
  846.  
  847. 2.7.  Time Synchronization
  848.  
  849.    Time synchronization, required by a management entity in order to
  850.    proceed with authentic communications, has occurred when the
  851.    management entity has obtained local values of agentBoots and
  852.    agentTime from the agent that are within the agent's time window.  To
  853.    remain synchronized, the local values must remain within the agent's
  854.    time window and thus must be kept loosely synchronized with the
  855.    values stored at the agent.  In addition to keeping a local version
  856.    of agentBoots and agentTime, a manager must also keep one other local
  857.    variable, latestReceivedAgentTime.  This value records the highest
  858.    value of agentTime that was received by the manager from the agent
  859.    and is used to eliminate the possibility of replaying messages that
  860.    would prevent the manager's notion of the agentTime from advancing.
  861.  
  862.    Time synchronization occurs as part of the procedures of receiving a
  863.    message (Section 3.2, step 9d). As such, no explicit time
  864.    synchronization procedure is required by a management entity.  Note,
  865.    that whenever the local value of agentID is changed (e.g., through
  866.    discovery) or when a new secret is configured, the local values of
  867.    agentBoots and latestReceivedAgentTime should be set to zero. This
  868.    will cause the time synchronization to occur when the next authentic
  869.    message is received.
  870.  
  871. 2.8.  Proxy Error Propagation
  872.  
  873.    When a proxy SNMPv2 agent receives a report PDU from a proxied agent
  874.    and it is determined that a proxy-forwarded request cannot be
  875.    delivered to the proxied agent, then the snmpProxyDrops counter [15]
  876.    is incremented and a report PDU is generated and transmitted to the
  877.    transport address from which the original request was received.
  878.    (Note that the receipt of a report PDU containing snmpProxyDrops as a
  879.    VarBind, is included among the reasons why a proxy-forwarded request
  880.    cannot be delivered.)
  881.  
  882. 2.9.  SNMPv2 Messages Using this Model
  883.  
  884.    The syntax of an SNMPv2 message using this security model differs
  885.    from that of an SNMPv1 [2] message as follows:
  886.  
  887.   -  The version component is changed to 2.
  888.  
  889.   -  The data component contains either a PDU or an OCTET STRING
  890.      containing an encrypted PDU.
  891.  
  892.    The SNMPv1 community string is now termed the "parameters" component
  893.    and contains a set of administrative information for the message.
  894.  
  895.  
  896.  
  897.  
  898. Waters                        Experimental                     [Page 16]
  899.  
  900. RFC 1910          User-based Security Model for SNMPv2     February 1996
  901.  
  902.  
  903.    Only the PDU is protected from disclosure by the privacy protocol.
  904.    This exposes the administrative information to eavesdroppers.
  905.    However, malicious use of this information is considered to be a
  906.    Traffic Analysis attack against which protection is not provided.
  907.  
  908.    For an authenticated SNMPv2 message, the message digest is applied to
  909.    the entire message given to the transport service.  As such, message
  910.    generation first privatizes the PDU, then adds the message wrapper,
  911.    and then authenticates the message.
  912.  
  913.    An SNMPv2 message is an ASN.1 value with the following syntax:
  914.  
  915.      Message ::=
  916.          SEQUENCE {
  917.              version
  918.                  INTEGER { v2 (2) },
  919.  
  920.              parameters
  921.                  OCTET STRING,
  922.              -- <model=1>
  923.              --      <qoS><agentID><agentBoots><agentTime><maxSize>
  924.              --      <userLen><userName><authLen><authDigest>
  925.              --      <contextSelector>
  926.  
  927.              data
  928.                  CHOICE {
  929.                      plaintext
  930.                          PDUs,
  931.                      encrypted
  932.                          OCTET STRING
  933.                  }
  934.          }
  935.  
  936. where:
  937.  
  938.   parameters
  939.      a concatenation of the following values in network-byte order.  If
  940.      the first octet (<model>) is one, then
  941.  
  942.      <qoS>    = 8-bits of quality-of-service
  943.  
  944.               bitnumber
  945.               7654 3210     meaning
  946.               ---- ----     --------------------------------
  947.               .... ..00     no authentication nor privacy
  948.               .... ..01     authentication, no privacy
  949.               .... ..1.     authentication and privacy
  950.               .... .1..     generation of report PDU allowed
  951.  
  952.  
  953.  
  954. Waters                        Experimental                     [Page 17]
  955.  
  956. RFC 1910          User-based Security Model for SNMPv2     February 1996
  957.  
  958.  
  959.               where bit 7 is the most significant bit.
  960.  
  961.      <agentID>    = 12 octets
  962.           a unique identifier for the agent (or dual-role entity).
  963.  
  964.      <agentBoots> = 32-bits
  965.           an unsigned quantity (0..4294967295) in network-byte order.
  966.  
  967.      <agentTime>  = 32-bits
  968.           an unsigned quantity (0..2147483647) in network-byte order.
  969.  
  970.      <maxSize>    = 16-bits
  971.           an unsigned quantity (484..65507) in network-byte order, which
  972.           identifies the maximum message size which the sender of this
  973.           message can receive using the same transport domain as used
  974.           for this message.
  975.  
  976.      <userLen>    = 1 octet
  977.           the length of following <userName> field.
  978.  
  979.      <userName>   = 1..16 arbitrary octets
  980.           the user on whose behalf this message is sent.
  981.  
  982.      <authLen>    = 1 octet
  983.           the length of following <authDigest> field.
  984.  
  985.      <authDigest> = 0..255 octets
  986.           for authenticated messages, the authentication digest.
  987.           Otherwise, the value has zero-length on transmission and is
  988.           ignored on receipt.
  989.  
  990.      <contextSelector> = 0..40 arbitrary octets
  991.           the context selector which in combination with agentID
  992.           identifies the SNMPv2 context containing the management
  993.           information referenced by the SNMPv2 message.
  994.  
  995.   plaintext
  996.      an SNMPv2 PDU as defined in [12].
  997.  
  998.   encrypted
  999.      the encrypted form of an SNMPv2 PDU.
  1000.  
  1001. 2.10.  Local Configuration Datastore (LCD)
  1002.  
  1003.    Each SNMPv2 entity maintains a local conceptually database, called
  1004.    the Local Configuration Datastore (LCD), which holds its known set of
  1005.    information about SNMPv2 users and other associated (e.g., access
  1006.    control) information.  An LCD may potentially be required to hold
  1007.  
  1008.  
  1009.  
  1010. Waters                        Experimental                     [Page 18]
  1011.  
  1012. RFC 1910          User-based Security Model for SNMPv2     February 1996
  1013.  
  1014.  
  1015.    information about multiple SNMPv2 agent entities. As such, the
  1016.    <agentID> should be used to identify a particular agent entity in the
  1017.    LCD.
  1018.  
  1019.    It is a local implementation issue as to whether information in the
  1020.    LCD is stored information or whether it is obtained dynamically
  1021.    (e.g., as a part of an SNMPv2 manager's API) on an as-needed basis.
  1022.  
  1023. 3.  Elements of Procedure
  1024.  
  1025.    This section describes the procedures followed by an SNMPv2 entity in
  1026.    processing SNMPv2 messages.
  1027.  
  1028. 3.1.  Generating a Request or Notification
  1029.  
  1030.    This section describes the procedure followed by an SNMPv2 entity
  1031.    whenever it generates a message containing a management operation
  1032.    (either a request or a notification) on behalf of a user, for a
  1033.    particular context and with a particular qoS value.
  1034.  
  1035. (1)  Information concerning the user is extracted from the LCD.  The
  1036.      transport domain and transport address to which the operation is to
  1037.      be sent is determined.  The context is resolved into an agentID
  1038.      value and a contextSelector value.
  1039.  
  1040. (2)  If the qoS specifies that the message is to be protected from
  1041.      disclosure, but the user does not support both an authentication
  1042.      and a privacy protocol, or does not have configured authentication
  1043.      and privacy keys, then the operation cannot be sent.
  1044.  
  1045. (3)  If the qoS specifies that the message is to be authenticated, but
  1046.      the user does not support an authentication protocol, or does not
  1047.      have a configured authentication key, then the operation cannot be
  1048.      sent.
  1049.  
  1050. (4)  The operation is serialized (i.e., encoded) according to the
  1051.      conventions of [13] and [12] into a PDUs value.
  1052.  
  1053. (5)  If the operation is a Get, GetNext, GetBulk, or Set then the report
  1054.      flag in the qoS is set to the value 1.
  1055.  
  1056. (6)  An SNMPv2 message is constructed using the ASN.1 Message syntax:
  1057.  
  1058.      - the version component is set to the value 2.
  1059.  
  1060.      - if the qoS specifies that the message is to be protected from
  1061.        disclosure, then the octet sequence representing the serialized
  1062.        PDUs value is encrypted according to the user's privacy protocol
  1063.  
  1064.  
  1065.  
  1066. Waters                        Experimental                     [Page 19]
  1067.  
  1068. RFC 1910          User-based Security Model for SNMPv2     February 1996
  1069.  
  1070.  
  1071.        and privacy key, and the encrypted data is encoded as an octet
  1072.        string and is used as the data component of the message.
  1073.  
  1074.      - if the qoS specifies that the message is not to be protected from
  1075.        disclosure, then the serialized PDUs value is used directly as
  1076.        the value of the data component.
  1077.  
  1078.      - the parameters component is constructed using:
  1079.  
  1080.        - the requested qoS, userName, agentID and context selector,
  1081.  
  1082.        - if the qoS specifies that the message is to be authenticated or
  1083.          the management operation is a notification, then the current
  1084.          values of agentBoots, and agentTime corresponding to agentID
  1085.          from the LCD are used.  Otherwise, the <agentBoots> and
  1086.          <agentTime> fields are set to zero-filled octets.
  1087.  
  1088.        - the <maxSize> field is set to the maximum message size which
  1089.          the local SNMPv2 entity can receive using the transport domain
  1090.          which will be used to send this message.
  1091.  
  1092.        - if the qoS specifies that the message is to be authenticated,
  1093.          then the <authDigest> field is temporarily set to the user's
  1094.          authentication key.  Otherwise, the <authDigest> field is set
  1095.          to the zero-length string.
  1096.  
  1097. (7)  The constructed Message value is serialized (i.e., encoded)
  1098.      according to the conventions of [13] and [12].
  1099.  
  1100. (8)  If the qoS specifies that the message is to be authenticated, then
  1101.      an MD5 digest value is computed over the octet sequence
  1102.      representing the concatenation of the serialized Message value and
  1103.      the user's authentication key.  The <authDigest> field is then set
  1104.      to the computed digest value.
  1105.  
  1106. (9)  The serialized Message value is transmitted to the determined
  1107.      transport address.
  1108.  
  1109. 3.2.  Processing a Received Communication
  1110.  
  1111.    This section describes the procedure followed by an SNMPv2 entity
  1112.    whenever it receives an SNMPv2 message.  This procedure is
  1113.    independent of the transport service address at which the message was
  1114.    received.  For clarity, some of the details of this procedure are
  1115.    left out and are described in Section 3.2.1 and its sub-sections.
  1116.  
  1117. (1)  The snmpInPkts counter [15] is incremented.  If the received
  1118.      message is not the serialization (according to the conventions of
  1119.  
  1120.  
  1121.  
  1122. Waters                        Experimental                     [Page 20]
  1123.  
  1124. RFC 1910          User-based Security Model for SNMPv2     February 1996
  1125.  
  1126.  
  1127.      [13]) of a Message value, then the snmpInASNParseErrs counter [15]
  1128.      is incremented, and the message is discarded without further
  1129.      processing.
  1130.  
  1131. (2)  If the value of the version component has a value other than 2,
  1132.      then the message is either processed according to some other
  1133.      version of this protocol, or the snmpInBadVersions counter [15] is
  1134.      incremented, and the message is discarded without further
  1135.      processing.
  1136.  
  1137. (3)  The value of the <model> field is extracted from the parameters
  1138.      component of the Message value.  If the value of the <model> field
  1139.      is not 1, then either the message is processed according to some
  1140.      other security model, or the usecStatsBadParameters counter is
  1141.      incremented, and the message is discarded without further
  1142.      processing.
  1143.  
  1144. (4)  The values of the rest of the fields are extracted from the
  1145.      parameters component of the Message value.
  1146.  
  1147. (5)  If the <agentID> field contained in the parameters is unknown then:
  1148.  
  1149.      - a manager that performs discovery may optionally create a new LCD
  1150.        entry and continue processing; or
  1151.  
  1152.      - the usecStatsUnknownContexts counter is incremented, a report PDU
  1153.        is generated, and the received message is discarded without
  1154.        further processing.
  1155.  
  1156. (6)  The LCD is consulted for information about the SNMPv2 context
  1157.      identified by the combination of the <agentID> and
  1158.      <contextSelector> fields.  If information about this SNMPv2 context
  1159.      is absent from the LCD, then the usecStatsUnknownContexts counter
  1160.      is incremented, a report PDU is generated, and the received message
  1161.      is discarded without further processing.
  1162.  
  1163. (7)  Information about the value of the <userName> field is extracted
  1164.      from the LCD.  If no information is available, then the
  1165.      usecStatsUnknownUserNames counter is incremented, a report PDU [1]
  1166.      is generated, and the received message is discarded without further
  1167.      processing.
  1168.  
  1169. (8)  If the information about the user indicates that it does not
  1170.      support the quality of service indicated by the <qoS> field, then
  1171.      the usecStatsUnsupportedQoS counter is incremented, a report PDU is
  1172.      generated, and the received message is discarded without further
  1173.      processing.
  1174.  
  1175.  
  1176.  
  1177.  
  1178. Waters                        Experimental                     [Page 21]
  1179.  
  1180. RFC 1910          User-based Security Model for SNMPv2     February 1996
  1181.  
  1182.  
  1183. (9)  If the <qoS> field indicates an authenticated message and the
  1184.      user's authentication protocol is the Digest Authentication
  1185.      Protocol described in this memo, then:
  1186.  
  1187.      a) the local values of agentBoots and agentTime corresponding to
  1188.         the value of the <agentID> field are extracted from the LCD.
  1189.  
  1190.      b) the value of <authDigest> field is temporarily saved.  A new
  1191.         serialized Message is constructed which differs from that
  1192.         received in exactly one respect: that the <authDigest> field
  1193.         within it has the value of the user's authentication key.  An
  1194.         MD5 digest value is computed over the octet sequence
  1195.         representing the concatenation of the new serialized Message and
  1196.         the user's authentication key.
  1197.  
  1198.      c) if the LCD information indicates the SNMPv2 context is of type
  1199.         local (i.e., an agent), then:
  1200.  
  1201.         - if the computed digest differs from the saved authDigest
  1202.           value, then the usecStatsWrongDigestValues counter is
  1203.           incremented, a report PDU is generated, and the received
  1204.           message is discarded without further processing. However, if
  1205.           the snmpEnableAuthenTraps object [15] is enabled, then the
  1206.           SNMPv2 entity sends authenticationFailure traps [15] according
  1207.           to its configuration.
  1208.  
  1209.         - if any of the following conditions is true, then the message
  1210.           is considered to be outside of the Time Window:
  1211.  
  1212.           - the local value of agentBoots is 0xffffffff;
  1213.  
  1214.           - the <agentBoots> field differs from the local value of
  1215.             agentBoots; or,
  1216.  
  1217.           - the value of the <agentTime> field differs from the local
  1218.             notion of agentTime by more than +/- 150 seconds.
  1219.  
  1220.         - if the message is considered to be outside of the Time Window
  1221.           then the usecStatsNotInWindows counter is incremented, an
  1222.           authenticated report PDU is generated (see section 2.7), and
  1223.           the received message is discarded without further processing.
  1224.  
  1225.      d) if the LCD information indicates the SNMPv2 context is not
  1226.         realized by the local SNMPv2 entity (i.e., a manager), then:
  1227.  
  1228.         - if the computed digest differs from the saved authDigest
  1229.           value, then the usecStatsWrongDigestValues counter is
  1230.           incremented and the received message is discarded without
  1231.  
  1232.  
  1233.  
  1234. Waters                        Experimental                     [Page 22]
  1235.  
  1236. RFC 1910          User-based Security Model for SNMPv2     February 1996
  1237.  
  1238.  
  1239.           further processing.
  1240.  
  1241.         - if all of the following conditions are true:
  1242.  
  1243.              - if the <qoS> field indicates that privacy is not in use;
  1244.  
  1245.              - the SNMPv2 operation type determined from the ASN.1 tag
  1246.                value associated with the PDU's component is a Report;
  1247.  
  1248.              - the Report was generated due to a usecStatsNotInWindows
  1249.                error condition; and,
  1250.  
  1251.              - the <agentBoots> field is greater than the local value of
  1252.                agentBoots, or the <agentBoots> field is equal to the
  1253.                local value of agentBoots and the <agentTime> field is
  1254.                greater than the value of latestReceivedAgentTime,
  1255.  
  1256.           then the LCD entry corresponding to the value of the <agentID>
  1257.           field is updated, by setting the local value of agentBoots
  1258.           from the <agentBoots> field, the value latestReceivedAgentTime
  1259.           from the <agentTime> field, and the local value of agentTime
  1260.           from the <agentTime> field.
  1261.  
  1262.         - if any of the following conditions is true, then the message
  1263.           is considered to be outside of the Time Window:
  1264.  
  1265.           - the local value of agentBoots is 0xffffffff;
  1266.  
  1267.           - the <agentBoots> field is less than the local value of
  1268.             agentBoots; or,
  1269.  
  1270.           - the <agentBoots> field is equal to the local value of
  1271.             agentBoots and the <agentTime> field is more than 150
  1272.             seconds less than the local notion of agentTime.
  1273.  
  1274.         - if the message is considered to be outside of the Time Window
  1275.           then the usecStatsNotInWindows counter is incremented, and the
  1276.           received message is discarded without further processing;
  1277.           however, time synchronization procedures may be invoked.  Note
  1278.           that this procedure allows for <agentBoots> to be greater than
  1279.           the local value of agentBoots to allow for received messages
  1280.           to be accepted as authentic when received from an agent that
  1281.           has rebooted since the manager last re-synchronized.
  1282.  
  1283.         - if at least one of the following conditions is true:
  1284.  
  1285.              - the <agentBoots> field is greater than the local value of
  1286.                agentBoots; or,
  1287.  
  1288.  
  1289.  
  1290. Waters                        Experimental                     [Page 23]
  1291.  
  1292. RFC 1910          User-based Security Model for SNMPv2     February 1996
  1293.  
  1294.  
  1295.              - the <agentBoots> field is equal to the local value of
  1296.                agentBoots and the <agentTime> field is greater than the
  1297.                value of latestReceivedAgentTime,
  1298.  
  1299.           then the LCD entry corresponding to the value of the <agentID>
  1300.           field is updated, by setting the local value of agentBoots
  1301.           from the <agentBoots> field, the local value
  1302.           latestReceivedAgentTime from the <agentTime> field, and the
  1303.           local value of agentTime from the <agentTime> field.
  1304.  
  1305. (10) If the <qoS> field indicates use of a privacy protocol, then the
  1306.      octet sequence representing the data component is decrypted
  1307.      according to the user's privacy protocol to obtain a serialized
  1308.      PDUs value.  Otherwise the data component is assumed to directly
  1309.      contain the PDUs value.
  1310.  
  1311. (11) The SNMPv2 operation type is determined from the ASN.1 tag value
  1312.      associated with the PDUs component.
  1313.  
  1314. (12) If the SNMPv2 operation type is a Report, then the request-id in
  1315.      the PDU is correlated to an outstanding request, and if the
  1316.      correlation is successful, the appropriate action is taken (e.g.,
  1317.      time synchronization, proxy error propagation, etc.); in
  1318.      particular, if the report PDU indicates a usecStatsNotInWindows
  1319.      condition, then the outstanding request may be retransmitted (since
  1320.      the procedure in Step 9d above should have resulted in time
  1321.      synchronization).
  1322.  
  1323. (13) If the SNMPv2 operation type is either a Get, GetNext, GetBulk, or
  1324.      Set operation, then:
  1325.  
  1326.      a) if the LCD information indicates that the SNMPv2 context is of
  1327.         type remote or remote-proxy, then the
  1328.         usecStatsUnauthorizedOperations counter is incremented, a report
  1329.         PDU is generated, and the received message is discarded without
  1330.         further processing.
  1331.  
  1332.      b) the LCD is consulted for access rights authorized for
  1333.         communications using the indicated qoS, on behalf of the
  1334.         indicated user, and concerning management information in the
  1335.         indicated SNMPv2 context for the particular SNMPv2 operation
  1336.         type.
  1337.  
  1338.      c) if the SNMPv2 operation type is not among the authorized access
  1339.         rights, then the usecStatsUnauthorizedOperations counter is
  1340.         incremented, a report PDU is generated, and the received message
  1341.         is discarded without further processing.
  1342.  
  1343.  
  1344.  
  1345.  
  1346. Waters                        Experimental                     [Page 24]
  1347.  
  1348. RFC 1910          User-based Security Model for SNMPv2     February 1996
  1349.  
  1350.  
  1351.      d) The information extracted from the LCD concerning the user and
  1352.         the SNMPv2 context, together with the sending transport address
  1353.         of the received message is cached for later use in generating a
  1354.         response message.
  1355.  
  1356.      e) if the LCD information indicates the SNMPv2 context is of type
  1357.         local, then the management operation represented by the PDUs
  1358.         value is performed by the receiving SNMPv2 entity with respect
  1359.         to the relevant MIB view within the SNMPv2 context according to
  1360.         the procedures set forth in [12], where the relevant MIB view is
  1361.         determined according to the user, the agentID, the
  1362.         contextSelector, the qoS values and the type of operation
  1363.         requested.
  1364.  
  1365.      f) if the LCD information indicates the SNMPv2 context is of type
  1366.         local-proxy, then:
  1367.  
  1368.         i. the user, qoS, agentID, contextSelector and transport address
  1369.            to be used to forward the request are extracted from the LCD.
  1370.            If insufficient information concerning the user is currently
  1371.            available, then snmpProxyDrops counter [15] is incremented, a
  1372.            report PDU is generated, and the received message is
  1373.            discarded.
  1374.  
  1375.         ii. if an administrative flag in the LCD indicates that the
  1376.            message is to be forwarded using the SNMPv1 administrative
  1377.            framework, then the procedures described in [4] are invoked.
  1378.            Otherwise, a new SNMPv2 message is constructed: its PDUs
  1379.            component is copied from that in the received message except
  1380.            that the contained request-id is replaced by a unique value
  1381.            (this value will enable a subsequent response message to be
  1382.            correlated with this request); the <userName>, <qoS>,
  1383.            <agentID> and <contextSelector> fields are set to the values
  1384.            extracted from the LCD; the <maxSize> field is set to the
  1385.            minimum of the value in the received message and the local
  1386.            system's maximum message size for the transport domain which
  1387.            will be used to forward the message; and finally, the message
  1388.            is authenticated and/or protected from disclosure according
  1389.            to the qoS value.
  1390.  
  1391.         iii. the information cached in Step 13d above is augmented with
  1392.            the request-id of the received message as well as the
  1393.            request-id, agentID and contextSelector of the constructed
  1394.            message.
  1395.  
  1396.         iv. the constructed message is forwarded to the extracted
  1397.            transport address.
  1398.  
  1399.  
  1400.  
  1401.  
  1402. Waters                        Experimental                     [Page 25]
  1403.  
  1404. RFC 1910          User-based Security Model for SNMPv2     February 1996
  1405.  
  1406.  
  1407. (14) If the SNMPv2 operation type is an Inform, then:
  1408.  
  1409.      a) if the LCD information indicates the SNMPv2 context is of type
  1410.         local or local-proxy then the usecStatsUnauthorizedOperations
  1411.         counter is incremented, a report PDU is generated, and the
  1412.         received message is discarded without further processing.
  1413.  
  1414.      b) if the LCD information indicates the SNMPv2 context is of type
  1415.         remote, then the Inform operation represented by the PDUs value
  1416.         is performed by the receiving SNMPv2 entity according to the
  1417.         procedures set forth in [12].
  1418.  
  1419.      c) if the LCD information indicates the SNMPv2 context is of type
  1420.         remote-proxy, then:
  1421.  
  1422.         i. a single unique request-id is selected for use by all
  1423.            forwarded copies of this request.  This value will enable the
  1424.            first response message to be correlated with this request;
  1425.            other responses are not required and should be discarded when
  1426.            received, since the agent that originated the Inform only
  1427.            requires one response to its Inform.
  1428.  
  1429.         ii. information is extracted from the LCD concerning all
  1430.            combinations of userName, qoS, agentID, contextSelector and
  1431.            transport address with which the received message is to be
  1432.            forwarded.
  1433.  
  1434.         iii. for each such combination whose access rights permit Inform
  1435.            operations to be forwarded, a new SNMPv2 message is
  1436.            constructed, as follows: its PDUs component is copied from
  1437.            that in the received message except that the contained
  1438.            request-id is replaced by the value selected in Step i above;
  1439.            its <userName>, <qoS>, <agentID> and <contextSelector> fields
  1440.            are set to the values extracted in Step ii above; and its
  1441.            <maxSize> field is set to the minimum of the value in the
  1442.            received message and the local system's maximum message size
  1443.            for the transport domain which will be used to forward this
  1444.            message.
  1445.  
  1446.         iv. for each constructed SNMPv2 message, information concerning
  1447.            the <userName>, <qoS>, <agentID>, <contextSelector>,
  1448.            request-id and sending transport address of the received
  1449.            message, as well as the request- id, agentID and
  1450.            contextSelector of the constructed message, is cached for
  1451.            later use in generating a response message.
  1452.  
  1453.         v. each constructed message is forwarded to the appropriate
  1454.            transport address extracted from the LCD in step ii above.
  1455.  
  1456.  
  1457.  
  1458. Waters                        Experimental                     [Page 26]
  1459.  
  1460. RFC 1910          User-based Security Model for SNMPv2     February 1996
  1461.  
  1462.  
  1463. (15) If the SNMPv2 operation type is a Response, then:
  1464.  
  1465.      a) if the LCD information indicates the SNMPv2 context is of type
  1466.         local, then the usecStatsUnauthorizedOperations counter is
  1467.         incremented, a report PDU is generated, and the received message
  1468.         is discarded without further processing.
  1469.  
  1470.      b) if the LCD information indicates the SNMPv2 context is of type
  1471.         remote, then the Response operation represented by the PDUs
  1472.         value is performed by the receiving SNMPv2 entity according to
  1473.         the procedures set forth in [12].
  1474.  
  1475.      c) if the LCD information indicates the SNMPv2 context is of type
  1476.         local-proxy or remote-proxy, then:
  1477.  
  1478.         i. the request-id is extracted from the PDUs component of the
  1479.            received message.  The context's agentID and contextSelector
  1480.            values together with the extracted request-id are used to
  1481.            correlate this response message to the corresponding values
  1482.            for a previously forwarded request by inspecting the cache of
  1483.            information as augmented in Substep iii of Step 13f above or
  1484.            in Substep iv of 14c above.  If no such correlated
  1485.            information is found, then the received message is discarded
  1486.            without further processing.
  1487.  
  1488.         ii. a new SNMPv2 message is constructed: its PDUs component is
  1489.            copied from that in the received message except that the
  1490.            contained request-id is replaced by the value saved in the
  1491.            correlated information from the original request; its
  1492.            <userName>, <qoS>, <agentID> and <contextSelector> fields are
  1493.            set to the values saved from the received message. The
  1494.            <maxSize> field is set to the minimum of the value in the
  1495.            received message and the local system's maximum message size
  1496.            for the transport domain which will be used to forward the
  1497.            message. The message is authenticated and/or protected from
  1498.            disclosure according to the saved qoS value.
  1499.  
  1500.         iii. the constructed message is forwarded to the transport
  1501.            address saved in the correlated information as the sending
  1502.            transport address of the original request.
  1503.  
  1504.         iv. the correlated information is deleted from the cache of
  1505.            information.
  1506.  
  1507. (16) If the SNMPv2 operation type is a SNMPv2-Trap, then:
  1508.  
  1509.      a) if the LCD information indicates the SNMPv2 context is of type
  1510.         local or local-proxy, then the usecStatsUnauthorizedOperations
  1511.  
  1512.  
  1513.  
  1514. Waters                        Experimental                     [Page 27]
  1515.  
  1516. RFC 1910          User-based Security Model for SNMPv2     February 1996
  1517.  
  1518.  
  1519.         counter is incremented, a report PDU is generated, and the
  1520.         received message is discarded without further processing.
  1521.  
  1522.      b) if the LCD information indicates the SNMPv2 context is of type
  1523.         remote, then the SNMPv2-Trap operation represented by the PDUs
  1524.         value is performed by the receiving SNMPv2 entity according to
  1525.         the procedures set forth in [12].
  1526.  
  1527.      c) if the LCD information indicates the SNMPv2 context is of type
  1528.         remote-proxy, then:
  1529.  
  1530.         i. a unique request-id is selected for use in forwarding the
  1531.            message.
  1532.  
  1533.         ii. information is extracted from the LCD concerning all
  1534.            combinations of userName, qoS, agentID, contextSelector and
  1535.            transport address with which the received message is to be
  1536.            forwarded.
  1537.  
  1538.         iii. for each such combination whose access rights permit
  1539.            SNMPv2-Trap operations to be forwarded, a new SNMPv2 message
  1540.            is constructed, as follows: its PDUs component is copied from
  1541.            that in the received message except that the contained
  1542.            request-id is replaced by the value selected in Step i above;
  1543.            its <userName>, <qoS>, <agentID> and <contextSelector> fields
  1544.            are set to the values extracted in Step ii above.
  1545.  
  1546.         iv. each constructed message is forwarded to the appropriate
  1547.            transport address extracted from the LCD in step ii above.
  1548.  
  1549. 3.2.1.  Additional Details
  1550.  
  1551.    For the sake of clarity and to prevent the above procedure from being
  1552.    even longer, the following details were omitted from the above
  1553.    procedure.
  1554.  
  1555. 3.2.1.1.  ASN.1 Parsing Errors
  1556.  
  1557.    For ASN.1 parsing errors, the snmpInASNParseErrs counter [15] is
  1558.    incremented and a report PDU is generated whenever such an ASN.1
  1559.    parsing error is discovered.  However, if the parsing error causes
  1560.    the information able to be extracted from the message to be
  1561.    insufficient for generating a report PDU, then the report PDU is not
  1562.    sent.
  1563.  
  1564.  
  1565.  
  1566.  
  1567.  
  1568.  
  1569.  
  1570. Waters                        Experimental                     [Page 28]
  1571.  
  1572. RFC 1910          User-based Security Model for SNMPv2     February 1996
  1573.  
  1574.  
  1575. 3.2.1.2.  Incorrectly Encoded Parameters
  1576.  
  1577.    For an incorrectly encoded parameters component of the Message value
  1578.    (e.g., incorrect or inconsistent value of the <userLen> or <authLen>
  1579.    fields), the usecStatsBadParameters counter is incremented. Since the
  1580.    encoded parameters are in error, the report flag in the qoS cannot be
  1581.    reliably determined. Thus, no report PDU is generated for the
  1582.    incorrectly encoded parameters error condition.
  1583.  
  1584. 3.2.1.3.  Generation of a Report PDU
  1585.  
  1586.    Some steps specify that the received message is discarded without
  1587.    further processing whenever a report PDU is generated.  However:
  1588.  
  1589.   -  An SNMPv2 manager never generates a report PDU.
  1590.  
  1591.   -  If the operation type can reliably be determined and it is
  1592.      determined to be a Report, SNMPv2-Trap, Inform, or a Response then
  1593.      a report PDU is not generated.
  1594.  
  1595.   -  A report PDU is only generated when the report flag in the qoS is
  1596.      set to the value 1.
  1597.  
  1598.    A generated report PDU must always use the current values of agentID,
  1599.    agentBoots, and agentTime from the LCD.  In addition, a generated
  1600.    report PDU must whenever possible contain the same request-id value
  1601.    as in the PDU contained in the received message.  Meeting this
  1602.    constraint normally requires the message to be further processed just
  1603.    enough so as to extract its request-id. There are two situations in
  1604.    which the SNMPv2 request-id cannot be determined. The first situation
  1605.    occurs when the userName is unknown and the qoS indicates that the
  1606.    message is encrypted.  The other situation is when there is an ASN.1
  1607.    parsing error.  In cases where the the request-id cannot be
  1608.    determined, the default request-id value 2147483647 is used.
  1609.  
  1610. 3.2.1.4.  Cache Timeout
  1611.  
  1612.    Some steps specify that information is cached so that a Response
  1613.    operation may be correlated to the appropriate Request operation.
  1614.    However, a number of situations could cause the cache to grow without
  1615.    bound. One such situation is when the Response operation does not
  1616.    arrive or arrives "late" at the entity. In order to ensure that the
  1617.    cache does not grow without bound, it is recommended that cache
  1618.    entries be deleted when they are determined to be no longer valid. It
  1619.    is an implementation dependent decision as to how long cache entries
  1620.    remain valid, however, caching entries more than 150 seconds is not
  1621.    useful since any use of the cache entry after that time would
  1622.    generate a usecStatsNotInWindows error condition.
  1623.  
  1624.  
  1625.  
  1626. Waters                        Experimental                     [Page 29]
  1627.  
  1628. RFC 1910          User-based Security Model for SNMPv2     February 1996
  1629.  
  1630.  
  1631. 3.3.  Generating a Response
  1632.  
  1633.    The procedure for generating a response to an SNMPv2 management
  1634.    request is identical to the procedure for transmitting a request (see
  1635.    Section 3.1), with these exceptions:
  1636.  
  1637.   -  The response is sent on behalf of the same user and with the same
  1638.      value of the agentID and contextSelector as the request.
  1639.  
  1640.   -  The PDUs value of the responding Message value is the response
  1641.      which results from performing the operation specified in the
  1642.      original PDUs value.
  1643.  
  1644.   -  The authentication protocol and other relevant information for the
  1645.      user is obtained, not from the LCD, but rather from information
  1646.      cached (in Step 13d) when processing the original message.
  1647.  
  1648.   -  The serialized Message value is transmitted using any transport
  1649.      address belonging to the agent for the transport domain from which
  1650.      the corresponding request originated - even if that is different
  1651.      from any transport information obtained from the LCD.
  1652.  
  1653.   -  If the qoS specifies that the message is to be authenticated or the
  1654.      response is being generated by a SNMPv2 entity acting in an agent
  1655.      role, then the current values of agentBoots and agentTime from the
  1656.      LCD are used.  Otherwise, the <agentBoots> and <agentTime> fields
  1657.      are set to zero-filled octets.
  1658.  
  1659.   -  The report flag in the qoS is set to the value 0.
  1660.  
  1661. 4.  Discovery
  1662.  
  1663.    This security model requires that a discovery process obtain
  1664.    sufficient information about an SNMPv2 entity's agent in order to
  1665.    communicate with it.  Discovery requires the SNMPv2 manager to learn
  1666.    the agent's agentID value before communication may proceed.  This may
  1667.    be accomplished by formulating a get-request communication with the
  1668.    qoS set to noAuth/noPriv, the userName set to "public", the agentID
  1669.    set to all zeros (binary), the contextSelector set to "", and the
  1670.    VarBindList left empty.  The response to this message will be an
  1671.    reportPDU that contains the agentID within the <parameters> field
  1672.    (and containing the usecStatsUnknownContexts counter in the
  1673.    VarBindList). If authenticated communication is required then the
  1674.    discovery process may invoke the procedure described in Section 2.7
  1675.    to synchronize the clocks.
  1676.  
  1677.  
  1678.  
  1679.  
  1680.  
  1681.  
  1682. Waters                        Experimental                     [Page 30]
  1683.  
  1684. RFC 1910          User-based Security Model for SNMPv2     February 1996
  1685.  
  1686.  
  1687. 5.  Definitions
  1688.  
  1689. SNMPv2-USEC-MIB DEFINITIONS ::= BEGIN
  1690.  
  1691. IMPORTS
  1692.     MODULE-IDENTITY, OBJECT-TYPE, Counter32, Unsigned32,
  1693.     snmpModules
  1694.         FROM SNMPv2-SMI
  1695.     TEXTUAL-CONVENTION
  1696.         FROM SNMPv2-TC
  1697.     MODULE-COMPLIANCE, OBJECT-GROUP
  1698.         FROM SNMPv2-CONF;
  1699.  
  1700.  
  1701. usecMIB MODULE-IDENTITY
  1702.     LAST-UPDATED "9601120000Z"
  1703.     ORGANIZATION "IETF SNMPv2 Working Group"
  1704.     CONTACT-INFO
  1705.             "        Glenn W. Waters
  1706.  
  1707.              Postal: Bell-Northern Research, Ltd.
  1708.                      P.O. Box 3511, Station C
  1709.                      Ottawa, ON, K1Y 4H7
  1710.                      Canada
  1711.  
  1712.                 Tel: +1 613 763 3933
  1713.  
  1714.              E-mail: gwaters@bnr.ca"
  1715.     DESCRIPTION
  1716.             "The MIB module for SNMPv2 entities implementing the user-
  1717.             based security model."
  1718.     ::= { snmpModules 6 }
  1719.  
  1720.  
  1721. usecMIBObjects OBJECT IDENTIFIER ::= { usecMIB 1 }
  1722.  
  1723.  
  1724. -- Textual Conventions
  1725.  
  1726. AgentID ::= TEXTUAL-CONVENTION
  1727.     STATUS       current
  1728.     DESCRIPTION
  1729.             "An agent's administratively-unique identifier.
  1730.  
  1731.             The value for this object may not be all zeros or all 'ff'H.
  1732.  
  1733.             The initial value for this object may be configured via an
  1734.             operator console entry or via an algorithmic function.  In
  1735.  
  1736.  
  1737.  
  1738. Waters                        Experimental                     [Page 31]
  1739.  
  1740. RFC 1910          User-based Security Model for SNMPv2     February 1996
  1741.  
  1742.  
  1743.             the later case, the following guidelines are recommended:
  1744.  
  1745.               1) The first four octets are set to the binary equivalent
  1746.                  of the agent's SNMP network management private
  1747.                  enterprise number as assigned by the Internet Assigned
  1748.                  Numbers Authority (IANA).  For example, if Acme
  1749.                  Networks has been assigned { enterprises 696 }, the
  1750.                  first four octets would be assigned '000002b8'H.
  1751.  
  1752.               2) The remaining eight octets are the cookie whose
  1753.                  contents are determined via one or more enterprise-
  1754.                  specific methods.  Such methods must be designed so as
  1755.                  to maximize the possibility that the value of this
  1756.                  object will be unique in the agent's administrative
  1757.                  domain.  For example, the cookie may be the IP address
  1758.                  of the agent, or the MAC address of one of the
  1759.                  interfaces, with each address suitably padded with
  1760.                  random octets.  If multiple methods are defined, then
  1761.                  it is recommended that the cookie be further divided
  1762.                  into one octet that indicates the method being used and
  1763.                  seven octets which are a function of the method."
  1764.     SYNTAX     OCTET STRING (SIZE (12))
  1765.  
  1766.  
  1767. -- the USEC Basic group
  1768. --
  1769. -- a collection of objects providing basic instrumentation of
  1770. -- the SNMPv2 entity implementing the user-based security model
  1771.  
  1772.  
  1773. usecAgent       OBJECT IDENTIFIER ::= { usecMIBObjects 1 }
  1774.  
  1775. agentID OBJECT-TYPE
  1776.     SYNTAX     AgentID
  1777.     MAX-ACCESS read-only
  1778.     STATUS     current
  1779.     DESCRIPTION
  1780.             "The agent's administratively-unique identifier."
  1781.     ::= { usecAgent 1 }
  1782.  
  1783. agentBoots OBJECT-TYPE
  1784.     SYNTAX     Unsigned32
  1785.     MAX-ACCESS read-only
  1786.     STATUS     current
  1787.     DESCRIPTION
  1788.             "The number of times that the agent has re-initialized
  1789.             itself since its initial configuration."
  1790.     ::= { usecAgent 2 }
  1791.  
  1792.  
  1793.  
  1794. Waters                        Experimental                     [Page 32]
  1795.  
  1796. RFC 1910          User-based Security Model for SNMPv2     February 1996
  1797.  
  1798.  
  1799. agentTime OBJECT-TYPE
  1800.     SYNTAX     Unsigned32 (0..2147483647)
  1801.     UNITS      "seconds"
  1802.     MAX-ACCESS read-only
  1803.     STATUS     current
  1804.     DESCRIPTION
  1805.             "The number of seconds since the agent last incremented the
  1806.             agentBoots object."
  1807.     ::= { usecAgent 3 }
  1808.  
  1809. agentSize OBJECT-TYPE
  1810.     SYNTAX     INTEGER (484..65507)
  1811.     MAX-ACCESS read-only
  1812.     STATUS     current
  1813.     DESCRIPTION
  1814.             "The maximum length in octets of an SNMPv2 message which
  1815.             this agent will accept using any transport mapping."
  1816.     ::= { usecAgent 4 }
  1817.  
  1818.  
  1819. -- USEC statistics
  1820. --
  1821. -- a collection of objects providing basic instrumentation of
  1822. -- the SNMPv2 entity implementing the user-based security model
  1823.  
  1824. usecStats      OBJECT IDENTIFIER ::= { usecMIBObjects 2 }
  1825.  
  1826.  
  1827. usecStatsUnsupportedQoS OBJECT-TYPE
  1828.     SYNTAX     Counter32
  1829.     MAX-ACCESS read-only
  1830.     STATUS     current
  1831.     DESCRIPTION
  1832.             "The total number of packets received by the SNMPv2 entity
  1833.             which were dropped because they requested a quality-of-
  1834.             service that was unknown to the agent or otherwise
  1835.             unavailable."
  1836.     ::= { usecStats 1 }
  1837.  
  1838. usecStatsNotInWindows OBJECT-TYPE
  1839.     SYNTAX     Counter32
  1840.     MAX-ACCESS read-only
  1841.     STATUS     current
  1842.     DESCRIPTION
  1843.             "The total number of packets received by the SNMPv2 entity
  1844.             which were dropped because they appeared outside of the
  1845.             agent's window."
  1846.     ::= { usecStats 2 }
  1847.  
  1848.  
  1849.  
  1850. Waters                        Experimental                     [Page 33]
  1851.  
  1852. RFC 1910          User-based Security Model for SNMPv2     February 1996
  1853.  
  1854.  
  1855. usecStatsUnknownUserNames OBJECT-TYPE
  1856.     SYNTAX     Counter32
  1857.     MAX-ACCESS read-only
  1858.     STATUS     current
  1859.     DESCRIPTION
  1860.             "The total number of packets received by the SNMPv2 entity
  1861.             which were dropped because they referenced a user that was
  1862.             not known to the agent."
  1863.     ::= { usecStats 3 }
  1864.  
  1865. usecStatsWrongDigestValues OBJECT-TYPE
  1866.     SYNTAX     Counter32
  1867.     MAX-ACCESS read-only
  1868.     STATUS     current
  1869.     DESCRIPTION
  1870.             "The total number of packets received by the SNMPv2 entity
  1871.             which were dropped because they didn't contain the expected
  1872.             digest value."
  1873.     ::= { usecStats 4 }
  1874.  
  1875. usecStatsUnknownContexts OBJECT-TYPE
  1876.     SYNTAX     Counter32
  1877.     MAX-ACCESS read-only
  1878.     STATUS     current
  1879.     DESCRIPTION
  1880.             "The total number of packets received by the SNMPv2 entity
  1881.             which were dropped because they referenced a context that
  1882.             was not known to the agent."
  1883.     ::= { usecStats 5 }
  1884.  
  1885. usecStatsBadParameters OBJECT-TYPE
  1886.     SYNTAX     Counter32
  1887.     MAX-ACCESS read-only
  1888.     STATUS     current
  1889.     DESCRIPTION
  1890.             "The total number of packets received by the SNMPv2 entity
  1891.             which were dropped because the <parameters> field was
  1892.             improperly encoded or had invalid syntax."
  1893.     ::= { usecStats 6 }
  1894.  
  1895. usecStatsUnauthorizedOperations OBJECT-TYPE
  1896.     SYNTAX     Counter32
  1897.     MAX-ACCESS read-only
  1898.     STATUS     current
  1899.     DESCRIPTION
  1900.             "The total number of packets received by the SNMPv2 entity
  1901.             which were dropped because the PDU type referred to an
  1902.             operation that is invalid or not authorized."
  1903.  
  1904.  
  1905.  
  1906. Waters                        Experimental                     [Page 34]
  1907.  
  1908. RFC 1910          User-based Security Model for SNMPv2     February 1996
  1909.  
  1910.  
  1911.     ::= { usecStats 7 }
  1912.  
  1913.  
  1914. -- conformance information
  1915.  
  1916. usecMIBConformance
  1917.                OBJECT IDENTIFIER ::= { usecMIB 2 }
  1918.  
  1919. usecMIBCompliances
  1920.                OBJECT IDENTIFIER ::= { usecMIBConformance 1 }
  1921. usecMIBGroups  OBJECT IDENTIFIER ::= { usecMIBConformance 2 }
  1922.  
  1923.  
  1924. -- compliance statements
  1925.  
  1926. usecMIBCompliance MODULE-COMPLIANCE
  1927.     STATUS  current
  1928.     DESCRIPTION
  1929.             "The compliance statement for SNMPv2 entities which
  1930.             implement the SNMPv2 USEC model."
  1931.     MODULE  -- this module
  1932.         MANDATORY-GROUPS { usecBasicGroup,
  1933.                           usecStatsGroup }
  1934.     ::= { usecMIBCompliances 1 }
  1935.  
  1936.  
  1937. -- units of conformance
  1938.  
  1939. usecBasicGroup OBJECT-GROUP
  1940.     OBJECTS { agentID,
  1941.               agentBoots,
  1942.               agentTime,
  1943.               agentSize }
  1944.     STATUS  current
  1945.     DESCRIPTION
  1946.             "A collection of objects providing identification, clocks,
  1947.             and capabilities of an SNMPv2 entity which implements the
  1948.             SNMPv2 USEC model."
  1949.     ::= { usecMIBGroups 1 }
  1950.  
  1951. usecStatsGroup OBJECT-GROUP
  1952.     OBJECTS { usecStatsUnsupportedQoS,
  1953.               usecStatsNotInWindows,
  1954.               usecStatsUnknownUserNames,
  1955.               usecStatsWrongDigestValues,
  1956.               usecStatsUnknownContexts,
  1957.               usecStatsBadParameters,
  1958.               usecStatsUnauthorizedOperations }
  1959.  
  1960.  
  1961.  
  1962. Waters                        Experimental                     [Page 35]
  1963.  
  1964. RFC 1910          User-based Security Model for SNMPv2     February 1996
  1965.  
  1966.  
  1967.     STATUS  current
  1968.     DESCRIPTION
  1969.             "A collection of objects providing basic error statistics of
  1970.             an SNMPv2 entity which implements the SNMPv2 USEC model."
  1971.     ::= { usecMIBGroups 2 }
  1972.  
  1973. END
  1974.  
  1975. 6.  Security Considerations
  1976.  
  1977. 6.1.  Recommended Practices
  1978.  
  1979.    This section describes practices that contribute to the secure,
  1980.    effective operation of the mechanisms defined in this memo.
  1981.  
  1982.   -  A management station must discard SNMPv2 responses for which
  1983.      neither the request-id component nor the represented management
  1984.      information corresponds to any currently outstanding request.
  1985.  
  1986.      Although it would be typical for a management station to do this as
  1987.      a matter of course, when using these security protocols it is
  1988.      significant due to the possibility of message duplication
  1989.      (malicious or otherwise).
  1990.  
  1991.   -  A management station must generate unpredictable request-ids in
  1992.      authenticated messages in order to protect against the possibility
  1993.      of message duplication (malicious or otherwise).
  1994.  
  1995.   -  A management station should perform time synchronization using
  1996.      authenticated messages in order to protect against the possibility
  1997.      of message duplication (malicious or otherwise).
  1998.  
  1999.   -  When sending state altering messages to a managed agent, a
  2000.      management station should delay sending successive messages to the
  2001.      managed agent until a positive acknowledgement is received for the
  2002.      previous message or until the previous message expires.
  2003.  
  2004.      No message ordering is imposed by the SNMPv2. Messages may be
  2005.      received in any order relative to their time of generation and each
  2006.      will be processed in the ordered received. Note that when an
  2007.      authenticated message is sent to a managed agent, it will be valid
  2008.      for a period of time of approximately 150 seconds under normal
  2009.      circumstances, and is subject to replay during this period.
  2010.      Indeed, a management station must cope with the loss and re-
  2011.      ordering of messages resulting from anomalies in the network as a
  2012.      matter of course.
  2013.  
  2014.  
  2015.  
  2016.  
  2017.  
  2018. Waters                        Experimental                     [Page 36]
  2019.  
  2020. RFC 1910          User-based Security Model for SNMPv2     February 1996
  2021.  
  2022.  
  2023.      However, a managed object, snmpSetSerialNo [15], is specifically
  2024.      defined for use with SNMPv2 set operations in order to provide a
  2025.      mechanism to ensure the processing of SNMPv2 messages occurs in a
  2026.      specific order.
  2027.  
  2028.   -  The frequency with which the secrets of an SNMPv2 user should be
  2029.      changed is indirectly related to the frequency of their use.
  2030.  
  2031.      Protecting the secrets from disclosure is critical to the overall
  2032.      security of the protocols. Frequent use of a secret provides a
  2033.      continued source of data that may be useful to a cryptanalyst in
  2034.      exploiting known or perceived weaknesses in an algorithm.  Frequent
  2035.      changes to the secret avoid this vulnerability.
  2036.  
  2037.      Changing a secret after each use is generally regarded as the most
  2038.      secure practice, but a significant amount of overhead may be
  2039.      associated with that approach.
  2040.  
  2041.      Note, too, in a local environment the threat of disclosure may be
  2042.      less significant, and as such the changing of secrets may be less
  2043.      frequent.  However, when public data networks are the communication
  2044.      paths, more caution is prudent.
  2045.  
  2046. 6.2.  Defining Users
  2047.  
  2048.    The mechanisms defined in this document employ the notion of "users"
  2049.    having access rights.  How "users" are defined is subject to the
  2050.    security policy of the network administration. For example, users
  2051.    could be individuals (e.g., "joe" or "jane"), or a particular role
  2052.    (e.g., "operator" or "administrator"), or a combination (e.g., "joe-
  2053.    operator", "jane-operator" or "joe-admin").  Furthermore, a "user"
  2054.    may be a logical entity, such as a manager station application or set
  2055.    of manager station applications, acting on behalf of a individual or
  2056.    role, or set of individuals, or set of roles, including combinations.
  2057.  
  2058.    Appendix A describes an algorithm for mapping a user "password" to a
  2059.    16 octet value for use as either a user's authentication key or
  2060.    privacy key (or both).  Passwords are often generated, remembered,
  2061.    and input by a human.  Human-generated passwords may be less than the
  2062.    16 octets required by the authentication and privacy protocols, and
  2063.    brute force attacks can be quite easy on a relatively short ASCII
  2064.    character set.  Therefore, the algorithm is Appendix A performs a
  2065.    transformation on the password.  If the Appendix A algorithm is used,
  2066.    agent implementations (and agent configuration applications) must
  2067.    ensure that passwords are at least 8 characters in length.
  2068.  
  2069.    Because the Appendix A algorithm uses such passwords (nearly)
  2070.    directly, it is very important that they not be easily guessed.  It
  2071.  
  2072.  
  2073.  
  2074. Waters                        Experimental                     [Page 37]
  2075.  
  2076. RFC 1910          User-based Security Model for SNMPv2     February 1996
  2077.  
  2078.  
  2079.    is suggested that they be composed of mixed-case alphanumeric and
  2080.    punctuation characters that don't form words or phrases that might be
  2081.    found in a dictionary.  Longer passwords improve the security of the
  2082.    system.  Users may wish to input multiword phrases to make their
  2083.    password string longer while ensuring that it is memorable.
  2084.  
  2085.    Note that there is security risk in configuring the same "user" on
  2086.    multiple systems where the same password is used on each system,
  2087.    since the compromise of that user's secrets on one system results in
  2088.    the compromise of that user on all other systems having the same
  2089.    password.
  2090.  
  2091.    The algorithm in Appendix A avoids this problem by including the
  2092.    agent's agentID value as well as the user's password in the
  2093.    calculation of a user's secrets; this results in the user's secrets
  2094.    being different at different agents; however, if the password is
  2095.    compromised the algorithm in Appendix A is not effective.
  2096.  
  2097. 6.3.  Conformance
  2098.  
  2099.    To be termed a "Secure SNMPv2 implementation", an SNMPv2
  2100.    implementation:
  2101.  
  2102.  - must implement the Digest Authentication Protocol.
  2103.  
  2104.  - must, to the maximal extent possible, prohibit access to the
  2105.    secret(s) of each user about which it maintains information in a LCD,
  2106.    under all circumstances except as required to generate and/or
  2107.    validate SNMPv2 messages with respect to that user.
  2108.  
  2109.  - must implement the SNMPv2 USEC MIB.
  2110.  
  2111.    In addition, an SNMPv2 agent must provide initial configuration in
  2112.    accordance with Appendix A.1.
  2113.  
  2114.    Implementation of the Symmetric Encryption Protocol is optional.
  2115.  
  2116. 7.  Editor's Address
  2117.  
  2118.    Glenn W. Waters
  2119.    Bell-Northern Research Ltd.
  2120.    P.O. Box 3511, Station C
  2121.    Ottawa, Ontario  K1Y 4H7
  2122.    CA
  2123.  
  2124.    Phone: +1 613 763 3933
  2125.    EMail: gwaters@bnr.ca
  2126.  
  2127.  
  2128.  
  2129.  
  2130. Waters                        Experimental                     [Page 38]
  2131.  
  2132. RFC 1910          User-based Security Model for SNMPv2     February 1996
  2133.  
  2134.  
  2135. 8.  Acknowledgements
  2136.  
  2137.    This document is the result of significant work by three major
  2138.    contributors:
  2139.  
  2140.      Keith McCloghrie (Cisco Systems, kzm@cisco.com)
  2141.      Marshall T. Rose (Dover Beach Consulting, mrose@dbc.mtview.ca.us)
  2142.      Glenn W. Waters (Bell-Northern Research Ltd., gwaters@bnr.ca)
  2143.  
  2144.    The authors wish to acknowledge James M. Galvin of Trusted
  2145.    Information Systems who contributed significantly to earlier work on
  2146.    which this memo is based, and the general contributions of members of
  2147.    the SNMPv2 Working Group, and, in particular, Aleksey Y. Romanov and
  2148.    Steven L. Waldbusser.
  2149.  
  2150.    A special thanks is extended for the contributions of:
  2151.  
  2152.      Uri Blumenthal (IBM)
  2153.      Shawn Routhier (Epilogue)
  2154.      Barry Sheehan (IBM)
  2155.      Bert Wijnen (IBM)
  2156.  
  2157. 9.  References
  2158.  
  2159. [1]  McCloghrie, K., Editor, "An Administrative Infrastructure for
  2160.      SNMPv2", RFC 1909, Cisco Systems, January 1996.
  2161.  
  2162. [2]  Case, J., Fedor, M., Schoffstall, M., and J. Davin, "Simple
  2163.      Network Management Protocol", STD 15, RFC 1157, SNMP Research,
  2164.      Performance Systems International, MIT Laboratory for Computer
  2165.      Science, May 1990.
  2166.  
  2167. [3]  Rivest, R., "The MD5 Message-Digest Algorithm", RFC 1321, MIT
  2168.      Laboratory for Computer Science, April 1992.
  2169.  
  2170. [4]  The SNMPv2 Working Group, Case, J., McCloghrie, K., Rose, M., and
  2171.      S. Waldbusser, "Coexistence between Version 1 and Version 2 of
  2172.      the Internet-standard Network Management Framework", RFC 1908,
  2173.      January 1996.
  2174.  
  2175. [5]  Data Encryption Standard, National Institute of Standards and
  2176.      Technology.  Federal Information Processing Standard (FIPS)
  2177.      Publication 46-1.  Supersedes FIPS Publication 46, (January, 1977;
  2178.      reaffirmed January, 1988).
  2179.  
  2180. [6]  Data Encryption Algorithm, American National Standards Institute.
  2181.      ANSI X3.92-1981, (December, 1980).
  2182.  
  2183.  
  2184.  
  2185.  
  2186. Waters                        Experimental                     [Page 39]
  2187.  
  2188. RFC 1910          User-based Security Model for SNMPv2     February 1996
  2189.  
  2190.  
  2191. [7]  DES Modes of Operation, National Institute of Standards and
  2192.      Technology.  Federal Information Processing Standard (FIPS)
  2193.      Publication 81, (December, 1980).
  2194.  
  2195. [8]  Data Encryption Algorithm - Modes of Operation, American National
  2196.      Standards Institute.  ANSI X3.106-1983, (May 1983).
  2197.  
  2198. [9]  Guidelines for Implementing and Using the NBS Data Encryption
  2199.      Standard, National Institute of Standards and Technology.  Federal
  2200.      Information Processing Standard (FIPS) Publication 74, (April,
  2201.      1981).
  2202.  
  2203. [10] Validating the Correctness of Hardware Implementations of the NBS
  2204.      Data Encryption Standard, National Institute of Standards and
  2205.      Technology.  Special Publication 500-20.
  2206.  
  2207. [11] Maintenance Testing for the Data Encryption Standard, National
  2208.      Institute of Standards and Technology.  Special Publication 500-61,
  2209.      (August, 1980).
  2210.  
  2211. [12] The SNMPv2 Working Group, Case, J., McCloghrie, K., Rose, M., and
  2212.      S., Waldbusser, "Protocol Operations for Version 2 of the Simple
  2213.      Network Management Protocol (SNMPv2)", RFC 1905, January 1996.
  2214.  
  2215. [13] The SNMPv2 Working Group, Case, J., McCloghrie, K., Rose, M., and
  2216.      S. Waldbusser, "Transport Mappings for Version 2 of the Simple
  2217.      Network Management Protocol (SNMPv2)", RFC 1906, January 1996.
  2218.  
  2219. [14] Krawczyk, H., "Keyed-MD5 for Message Authentication", Work in
  2220.      Progress, IBM, June 1995.
  2221.  
  2222. [15] The SNMPv2 Working Group, Case, J., McCloghrie, K., Rose, M., and
  2223.      S. Waldbusser, "Management Information Base for Version 2 of the
  2224.      Simple Network Management Protocol (SNMPv2)", RFC 1907
  2225.      January 1996.
  2226.  
  2227.  
  2228.  
  2229.  
  2230.  
  2231.  
  2232.  
  2233.  
  2234.  
  2235.  
  2236.  
  2237.  
  2238.  
  2239.  
  2240.  
  2241.  
  2242. Waters                        Experimental                     [Page 40]
  2243.  
  2244. RFC 1910          User-based Security Model for SNMPv2     February 1996
  2245.  
  2246.  
  2247. APPENDIX A - Installation
  2248.  
  2249. A.1.   Agent Installation Parameters
  2250.  
  2251. During installation, an agent is configured with several parameters.
  2252. These include:
  2253.  
  2254. (1)  a security posture
  2255.  
  2256.      The choice of security posture determines the extent of the view
  2257.      configured for unauthenticated access.  One of three possible
  2258.      choices is selected:
  2259.  
  2260.           minimum-secure,
  2261.           semi-secure, or
  2262.           very-secure.
  2263.  
  2264. (2)  one or more transport service addresses
  2265.  
  2266.      These parameters may be specified explicitly, or they may be
  2267.      specified implicitly as the same set of network-layer addresses
  2268.      configured for other uses by the device together with the well-
  2269.      known transport-layer "port" information for the appropriate
  2270.      transport domain [13].  The agent listens on each of these
  2271.      transport service addresses for messages sent on behalf of any user
  2272.      it knows about.
  2273.  
  2274. (3)  one or more secrets
  2275.  
  2276.      These are the authentication/privacy secrets for the first user to
  2277.      be configured.
  2278.  
  2279.      One way to accomplish this is to have the installer enter a
  2280.      "password" for each required secret. The password is then
  2281.      algorithmically converted into the required secret by:
  2282.  
  2283.      - forming a string of length 1,048,576 octets by repeating the
  2284.        value of the password as often as necessary, truncating
  2285.        accordingly, and using the resulting string as the input to the
  2286.        MD5 algorithm. The resulting digest, termed "digest1", is used in
  2287.        the next step.
  2288.  
  2289.      - a second string of length 44 octets is formed by concatenating
  2290.        digest1, the agent's agentID value, and digest1. This string is
  2291.        used as input to the MD5 algorithm. The resulting digest is the
  2292.        required secret (see Appendix A.2).
  2293.  
  2294.  
  2295.  
  2296.  
  2297.  
  2298. Waters                        Experimental                     [Page 41]
  2299.  
  2300. RFC 1910          User-based Security Model for SNMPv2     February 1996
  2301.  
  2302.  
  2303.    With these configured parameters, the agent instantiates the
  2304.    following user, context, views and access rights.  This configuration
  2305.    information should be readOnly (persistent).
  2306.  
  2307.   -  One user:
  2308.  
  2309.                          privacy not supported   privacy supported
  2310.                          ---------------------   -----------------
  2311.        <userName>        "public"                "public"
  2312.        <authProtocol>    Digest Auth. Protocol   Digest Auth. Protocol
  2313.        <authPrivateKey>  authentication key      authentication key
  2314.        <privProtocol>    none                    Symmetric Privacy Protocol
  2315.        <privPrivateKey>  --                      privacy key
  2316.  
  2317.   -  One local context with its <contextSelector> as the empty-string.
  2318.  
  2319.   -  One view for authenticated access:
  2320.  
  2321.           - the <all> MIB view is the "internet" subtree.
  2322.  
  2323.   -  A second view for unauthenticated access.  This view is configured
  2324.      according to the selected security posture.  For the "very-secure"
  2325.      posture:
  2326.  
  2327.           - the <restricted> MIB view is the union of the "snmp" [15],
  2328.           "usecAgent" and "usecStats" subtrees.
  2329.  
  2330.      For the "semi-secure" posture:
  2331.  
  2332.           - the <restricted> MIB view is the union of the "snmp" [15],
  2333.           "usecAgent", "usecStats" and "system" subtrees.
  2334.  
  2335.      For the "minimum-secure" posture:
  2336.  
  2337.           - the <restricted> MIB view is the "internet" subtree.
  2338.  
  2339.   -  Access rights to allow:
  2340.  
  2341.         - read-only access for unauthenticated messages on behalf of the
  2342.           user "public" to the <restricted> MIB view of contextSelector
  2343.           "".
  2344.  
  2345.         - read-write access for authenticated but not private messages
  2346.           on behalf of the user "public" to the <all> MIB view of
  2347.           contextSelector "".
  2348.  
  2349.         - if privacy is supported, read-write access for authenticated
  2350.           and private messages on behalf of the user "public" to the
  2351.  
  2352.  
  2353.  
  2354. Waters                        Experimental                     [Page 42]
  2355.  
  2356. RFC 1910          User-based Security Model for SNMPv2     February 1996
  2357.  
  2358.  
  2359.           <all> MIB view of contextSelector "".
  2360.  
  2361. A.2.   Password to Key Algorithm
  2362.  
  2363.    The following code fragment demonstrates the password to key
  2364.    algorithm which can be used when mapping a password to an
  2365.    authentication or privacy key. (The calls to MD5 are as documented in
  2366.    RFC 1321.)
  2367.  
  2368. void password_to_key(password, passwordlen, agentID, key)
  2369.     u_char *password;       /* IN */
  2370.     u_int   passwordlen;    /* IN */
  2371.     u_char *agentID;        /* IN - pointer to 12 octet long agentID */
  2372.     u_char *key;            /* OUT - caller supplies pointer to 16
  2373.                                octet buffer */ {
  2374.     MD5_CTX     MD;
  2375.     u_char      *cp, password_buf[64];
  2376.     u_long      password_index = 0;
  2377.     u_long      count = 0, i;
  2378.  
  2379.     MD5Init (&MD);   /* initialize MD5 */
  2380.  
  2381.     /* loop until we've done 1 Megabyte */
  2382.     while (count < 1048576) {
  2383.         cp = password_buf;
  2384.         for(i = 0; i < 64; i++) {
  2385.             *cp++ = password[ password_index++ % passwordlen ];
  2386.             /*
  2387.              * Take the next byte of the password, wrapping to the
  2388.              * beginning of the password as necessary.
  2389.              */
  2390.         }
  2391.         MDupdate (&MD, password_buf, 64);
  2392.         count += 64;
  2393.     }
  2394.     MD5Final (key, &MD);              /* tell MD5 we're done */
  2395.  
  2396.     /* localize the key with the agentID and pass through MD5
  2397.       to produce final key */
  2398.     memcpy (password_buf, key, 16);
  2399.     memcpy (password_buf+16, agentID, 12);
  2400.     memcpy (password_buf+28, key, 16);
  2401.  
  2402.     MD5Init (&MD);
  2403.     MDupdate (&MD, password_buf, 44);
  2404.     MD5Final (key, &MD);
  2405.  
  2406.     return; }
  2407.  
  2408.  
  2409.  
  2410. Waters                        Experimental                     [Page 43]
  2411.  
  2412. RFC 1910          User-based Security Model for SNMPv2     February 1996
  2413.  
  2414.  
  2415. A.3.   Password to Key Sample
  2416.  
  2417.    The following shows a sample output of the password to key algorithm.
  2418.  
  2419.    With a password of "maplesyrup" the output of the password to key
  2420.    algorithm before the key is localized with the agent's agentID is:
  2421.  
  2422.     '9f af 32 83 88 4e 92 83 4e bc 98 47 d8 ed d9 63'H
  2423.  
  2424.    After the intermediate key (shown above) is localized with the
  2425.    agentID value of:
  2426.  
  2427.     '00 00 00 00 00 00 00 00 00 00 00 02'H
  2428.  
  2429.    the final output of the password to key algorithm is:
  2430.  
  2431.     '52 6f 5e ed 9f cc e2 6f 89 64 c2 93 07 87 d8 2b'H
  2432.  
  2433.  
  2434.  
  2435.  
  2436.  
  2437.  
  2438.  
  2439.  
  2440.  
  2441.  
  2442.  
  2443.  
  2444.  
  2445.  
  2446.  
  2447.  
  2448.  
  2449.  
  2450.  
  2451.  
  2452.  
  2453.  
  2454.  
  2455.  
  2456.  
  2457.  
  2458.  
  2459.  
  2460.  
  2461.  
  2462.  
  2463.  
  2464.  
  2465.  
  2466. Waters                        Experimental                     [Page 44]
  2467.  
  2468.